package com.kitty.game.item.service.handler;

import com.kitty.common.utils.SpringUtils;

import java.util.HashMap;
import java.util.Map;
/*融合处理类*/
public enum MergeItemHelper {
    INSTANCE;

    private static final Map<Short, MergerItemHandler> handlers = new HashMap<>();

    public void init(Short itemIndex, MergerItemHandler mergerItemHandler) {
        handlers.put(itemIndex, mergerItemHandler);
    }

    public MergerItemHandler getHandler(short itemIndex) {
        return handlers.get(itemIndex);
    }

    static {
        INSTANCE.init(ItemIndex.LIFE_MAX.getIndex(), SpringUtils.getBean("MergeHandler", MergeHandler.class));
        INSTANCE.init(ItemIndex.MANA_MAX.getIndex(), SpringUtils.getBean("ManaLingLongMergeHandler", ManaLingLongMergeHandler.class));
        INSTANCE.init(ItemIndex.MANA.getIndex(), SpringUtils.getBean("ManaMergeHandler", ManaMergeHandler.class));
        INSTANCE.init(ItemIndex.LIFE.getIndex(), SpringUtils.getBean("LifeMergeHandler", LifeMergeHandler.class));
        INSTANCE.init(ItemIndex.HYJJ.getIndex(), SpringUtils.getBean("HYJJMergeHandler", HYJJMergeHandler.class));
    }
}
